import socket

HOST = 'localhost'
PROT = 9999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect((HOST, PROT))

while True:
    msg = bytes(input('>>>'), encoding='utf-8')
    s.sendall(msg)
    data = s.recv(1024)
    print(data)

    print('Received', repr(data))

s.close()